﻿
@{
    ViewBag.Title = "ArrangeWork";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    });

    function gridList() {
        var $gridList = $("#HisgridList");
        $gridList.newtouchLocalDataGrid({
            //url: "/PatientManage/HospiterRes/GetGridJson",
            unwritten: false,
            shrinkToFit: true,
            height: $(window).height() - 185,
            datatype: "local",
            colModel: [
                { label: "主键", name: "id", hidden: true, key: true },//
                { label: '姓名', name: 'xm', width: 150, align: 'left' },
                { label: '工号', name: 'gh', width: 150, align: 'left' },
                { label: '年份', name: 'nf', width: 80, align: 'left' },
                { label: '月份', name: 'yf', width: 50, align: 'left' },
                { label: '天数', name: 'ts', width: 50, align: 'left', editable: true },
            ],
            onSelectRow: function (rowid) {
                var yf = $gridList.jqGrid('getRowData', rowid)["yf"];
                if (yf > 3) {
                    $gridList.jqGrid('editRow', rowid, true, null, function (result) {
                    });
                }
            },
            pager: "#gridPager",
            sortname: 'desc',
            rowNum: '10',
            viewrecords: true
        });

        var mydata = [
               { id: "1", xm: "潘显Patti", nf: "2017", yf: "5", ts: "22", gh: "1001" },
               { id: "2", xm: "王利群Kate", nf: "2017", yf: "5", ts: "10", gh: "1002" },
               { id: "3", xm: "魏增娟Wendy", nf: "2017", yf: "5", ts: "28", gh: "1003" },
        ];
        for (var i = 0; i <= mydata.length; i++) {
            $gridList.jqGrid('addRowData', i + 1, mydata[i]);
            $("#HisgridList").jqGrid('editRow', i, true, null, function (result) {
                //return false;   //验证输入内容是否合法，取消保存返回false    //无效 等等修复
                //});
            });
        }

    }

    function btn_add() {
        $("#HisgridList").jqGrid("clearGridData");
        var mydata = [
             { id: "1", xm: "潘显Patti", nf: "2017", yf: "5", ts: "22", gh: "1001" },
             { id: "2", xm: "王利群Kate", nf: "2017", yf: "5", ts: "10", gh: "1002" },
             { id: "3", xm: "魏增娟Wendy", nf: "2017", yf: "5", ts: "28", gh: "1003" },
        ];
        for (var i = 0; i <= mydata.length; i++) {
            $("#HisgridList").jqGrid('addRowData', i + 1, mydata[i]);
            $("#HisgridList").jqGrid('editRow', i, true, null, function (result) {
                //return false;   //验证输入内容是否合法，取消保存返回false    //无效 等等修复
                //});
            });
        }

        //$.modalOpen({
        //    id: "Form",
        //    title: "添加排班",
        //    url: "/TherapeutistCompleteList/AddArrange",
        //    width: "600px",
        //    height: "250px",
        //    callBack: function (iframeId) {
        //        top.frames[iframeId].submitForm();
        //    }
        //});
    }
</script>
<form id="form1">
    <div class="panel panel-default" style="margin-top:5px;">
        <div class="panel-heading">
            筛选条件
        </div>
        <div style="padding: 2px;padding-right:20px;">
            <table class="form">
                <tr>
                    <td class="formTitle">年份</td>
                    <td class="formValue">
                        <select id="Cl" class="form-control">
                            <option value="-1">===请选择===</option>
                            <option value="PT">2015</option>
                            <option value="OT">2016</option>
                            <option value="ST" selected="selected">2017</option>
                        </select>
                    </td>
                    <td class="formTitle">月份</td>
                    <td class="formValue">
                        <select id="Cl" class="form-control">
                            <option value="-1">===请选择===</option>
                            <option value="PT">1</option>
                            <option value="OT">2</option>
                            <option value="ST">3</option>
                            <option value="ST">4</option>
                            <option value="ST" selected="selected">5</option>
                            <option value="ST">6</option>
                        </select>
                    </td>
                    <td class="formTitle">关键字</td>
                    <td class="formValue">
                        <input type="text" id="txtINPUTCODE" class="form-control" placeholder="姓名 工号" />
                    </td>
                    <td colspan="2">
                        <div style="margin-left:80px">
                            <input type="button" id="btn_search" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                            <a class="menuItem btn btn-primary" onclick="btn_add()">新增排班</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
<div class="gridPanel">
    <table id="HisgridList"></table>
    <div id="gridPager"></div>
</div>

